package org.esprit.ocm.client.rpc.ec2;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

public interface ImageServiceAsync
{

    /**
     * GWT-RPC service  asynchronous (client-side) interface
     * @see org.esprit.ocm.client.rpc.ec2.ImageService
     */
    void listImages( boolean all, org.esprit.ocm.dto.impl.ServerDto server, org.esprit.ocm.dto.impl.AwsCredentialsDto credentials, AsyncCallback<java.util.List<org.esprit.ocm.dto.ec2.impl.ImageDescriptionDto>> callback );


    /**
     * GWT-RPC service  asynchronous (client-side) interface
     * @see org.esprit.ocm.client.rpc.ec2.ImageService
     */
    void runInstance( java.lang.String imageId, java.util.List<String> groups, java.lang.String keyName, byte[] userData, java.lang.String instanceType, int count, java.lang.String availabilityZone, java.lang.String kernelId, java.lang.String ramdiskId, org.esprit.ocm.dto.impl.ServerDto server, org.esprit.ocm.dto.impl.AwsCredentialsDto credentials, AsyncCallback<java.lang.String> callback );


    /**
     * GWT-RPC service  asynchronous (client-side) interface
     * @see org.esprit.ocm.client.rpc.ec2.ImageService
     */
    void stopInstance( java.util.List<java.lang.String> instanceId, org.esprit.ocm.dto.impl.ServerDto server, org.esprit.ocm.dto.impl.AwsCredentialsDto credentials, AsyncCallback<Void> callback );


    /**
     * GWT-RPC service  asynchronous (client-side) interface
     * @see org.esprit.ocm.client.rpc.ec2.ImageService
     */
    void rebootInstance( java.util.List<java.lang.String> instanceId, org.esprit.ocm.dto.impl.ServerDto server, org.esprit.ocm.dto.impl.AwsCredentialsDto credentials, AsyncCallback<Void> callback );


    /**
     * GWT-RPC service  asynchronous (client-side) interface
     * @see org.esprit.ocm.client.rpc.ec2.ImageService
     */
    void listInstances( org.esprit.ocm.dto.impl.ServerDto server, org.esprit.ocm.dto.impl.AwsCredentialsDto credentials, AsyncCallback<java.util.List<org.esprit.ocm.dto.ec2.impl.InstanceDescriptionDto>> callback );


    /**
     * Utility class to get the RPC Async interface from client-side code
     */
    public static final class Util 
    { 
        private static ImageServiceAsync instance;

        public static final ImageServiceAsync getInstance()
        {
            if ( instance == null )
            {
                instance = (ImageServiceAsync) GWT.create( ImageService.class );
                ServiceDefTarget target = (ServiceDefTarget) instance;
                target.setServiceEntryPoint( GWT.getModuleBaseURL() + "ImageService.rpc" );
            }
            return instance;
        }

        private Util()
        {
            // Utility class should not be instanciated
        }
    }
}
